package com.hainatong.jcmvvmbase.mainhome.adapter;

import com.chad.library.adapter.base.BaseProviderMultiAdapter;
import com.hainatong.jcmvvmbase.mainhome.entity.SysMsgBean;
import com.hainatong.jcmvvmbase.mainhome.entity.SysMsgTime;
import com.hainatong.mvvmbase.base.BaseBean;
import org.jetbrains.annotations.NotNull;

import java.util.List;

public class SysMsgAdapter extends BaseProviderMultiAdapter<BaseBean>
{
    public SysMsgAdapter()
    {
        super();
        addItemProvider(new MsgTimeProvider());
        addItemProvider(new SysMsgProvider());
    }

    @Override
    protected int getItemType(@NotNull List<? extends BaseBean> list, int i)
    {
        if( list.get(i) instanceof SysMsgTime)
        {
            return SysMsgItemType.MSG_TIME_VIEW;
        }
        else if( list.get(i) instanceof SysMsgBean)
        {
            return SysMsgItemType.MSG_VIEW;
        }
        return -1;
    }
}
